//k个一组翻转链表: https://www.nowcoder.com/exam/test/90958023/detail?pid=20725660
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int stringToInt(string s) {
    int count = 0;
    for (int i = 0; i < s.size(); i++) {
        count = count * 10 + (s[i] - '0');
    }
    return count;
}

int main() {
    string s;
    while (cin >> s) 
    {
        //用一个数组保存一年中当当前月累加的天数
        static int days[13] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 };
        vector<string> vec;
        string s1;
        //按照"-"分割年月日
        for (int i = 0; i < s.size(); i++) 
        {
            if (s[i] == '-') 
            {
                vec.push_back(s1);
                //清空，保存下一部分
                s1 = "";
            } 
            else 
            {
                s1 += s[i];
            }
        }
        //保存天
        vec.push_back(s1);
        //转整形
        int year = stringToInt(vec[0]);
        int month = stringToInt(vec[1]);
        int day = stringToInt(vec[2]);
        int ret = days[month - 1] + day;
        //如果是闰年，并且包含2月，需要补一天
        if (((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) && month > 2)
            ret++;
        cout << ret << endl;
    }
    return 0;
}